
import LogisticsMixin from '@src/mixins/logisticsMixin'
import { formatFormFieldItem } from '@src/filter/form'

export default {
  name: 'biz-list-logistics-no',
  mixins: [LogisticsMixin],
  props: {
    isLink: {
      type: Boolean,
      default: false,
    },
    row: {
      type: Object,
      default: () => ({}),
      required: true
    },
    column: {
      type: Object,
      default: () => ({}),
      required: true
    },
    mode: {
      type: String,
      default: ''
    },
    bizId: {
      type: String,
      default: ''
    }
  },
  render(h) {
    
    const classNames = {
      'link-text': this.isLink
    }
    
    const fieldName = this.column.fieldName
    const splitFieldNames = fieldName.split('_')
    const rawFieldName = `${splitFieldNames[0]}_${splitFieldNames[1]}`
    const value = this.row?.attribute?.[rawFieldName]
    
    return (
      <div 
        class={classNames}
        onClick={() => this.handlerClickViewLogisticsForList(this.row, this.column, this.mode, this.bizId)}
      >
        { formatFormFieldItem(this.column, value) }
      </div>
    )
    
  }
}